home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / IIGS / TN.IIGS.042 < prev    next >
Encoding:
Text File  |  1989-01-10  |  33.8 KB  |  822 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. Apple IIGS
  8. #42:    Custom Windows
  9.  
  10. Written by:    Dan Oliver & Keith Rollin                        November 1988
  11.  
  12. This Technical Note describes custom windows which are now supported with 
  13. Window Manager version 2.2.  This Note supersedes all prior documentation on 
  14. custom windows.
  15. _____________________________________________________________________________
  16.  
  17. With Window Manager version 2.2 or later, which is available on Apple IIGS 
  18. System Disk 3.2 and later, you may now define your own type of window or 
  19. window shape, such as a round or hexagonal window.  You also may define a 
  20. window which performs tasks that would normally be handled by an application.
  21.  
  22. To define your own type of window, a custom window, you must write a routine 
  23. that performs some window functions.  This routine is a window definition 
  24. procedure (defProc), and in this case it is a custom window defProc.  When the 
  25. Window Manager needs to do something window specific, it calls your defProc.
  26.  
  27. The window defProc is a good part of the Window Manager, and writing one is 
  28. not an easy task.  A window defProc must perform complicated tasks that are 
  29. very dependent on the state of the machine, and it must be very careful not to 
  30. disturb the state of the machine.  One of the problems in writing a defProc is 
  31. knowing when it can do something and when it cannot.  It is almost impossible 
  32. to document all of the combinations of calls that you can or cannot make from 
  33. one part or another of the defProc, and even if all cases were found, the 
  34. resulting document would read like something from an obscure government bureau 
  35. and probably be even harder to understand.
  36.  
  37. Now that you know writing a defProc is tough, here's how to make things as 
  38. easy as possible.  Try to understand how the system interacts with the defProc 
  39. and work with the system.  For example, a defProc is called to hit test window 
  40. parts when the user presses the mouse button.  The Window Manager will pass 
  41. that part back to the defProc to perform drawing while the Window Manager is 
  42. tracking the pressed button.  The defProc could keep control when asked to hit 
  43. test and perform the tracking itself, but since this is not how the system is 
  44. designed to work, your defProc will be hard to write, may not ever work 
  45. correctly, and may break in future versions of the Window Manager.  Try to 
  46. stay on the path outlined in this Technical Note.  Also understand that the 
  47. interface to definition procedures is as general as possible to allow them to 
  48. perform tasks which are as yet unknown.  To allow for this future growth, the 
  49. outlined path is not always a clear path.
  50.  
  51. Another way to make things easier is to write conservative code.  Do not 
  52. assume things like the data bank being set to something nice when the defProc 
  53. is called or the caller restoring the direct page pointer upon return if you 
  54. have changed it.  Use caution.  A defProc can be very difficult to debug 
  55. because it is not very linear and can be called when you least expect.
  56.  
  57.  
  58. Interaction Between the Window Manager and TaskMaster
  59.  
  60. The Window Manager and TaskMaster actually do much less than many people think 
  61. since window definition procedures perform most of the tasks.  The definition 
  62. procedures handle such things as title bars, information bars, and scroll 
  63. bars, while the Window Manager and TaskMaster support these things by passing 
  64. requests to the defProc in standard ways.  The Window Manager knows that 
  65. windows have some shape, overlap, may contain parts, may be invisible, and are 
  66. created and deleted, but it does not know much else.  TaskMaster knows to call 
  67. GetNextEvent and performs some tasks, but much of what many people consider 
  68. TaskMaster is contained in the standard document window defProc.  In addition 
  69. to the list mentioned above, the defProc handles calling TrackGoAway and 
  70. scrolling the content.  The remainder of this Note describes what is expected 
  71. of a defProc and when.
  72.  
  73.  
  74. Telling the Window Manager About Your Window
  75.  
  76. You tell the Window Manager about your custom window when NewWindow creates 
  77. it.  Instead of passing the parameter list defined in NewWindow, you pass a 
  78. pointer to a custom window parameter list.  A custom window parameter list is 
  79. defined as follows:
  80.  
  81.     paramID       WORD       ID of parameter list, zero for custom.
  82.     newDefProc    LONG       Address of your custom defProc.
  83.     newData       BYTE[n]    Additional data defined by your defProc.
  84.  
  85. NewWindow checks the paramID field and calls your defProc with the pointer to 
  86. the parameter list.  See the wNew operation under Calling the Custom DefProc 
  87. for more information.
  88.  
  89. Once NewWindow creates the window, the Window Manager will always know that it 
  90. is defined by your defProc.
  91.  
  92.  
  93. Calling the Custom defProc
  94.  
  95. A window defProc is called with the following items on the stack:
  96.  
  97.     16 |result                     | LONG - result returned to Window Manager,
  98.        |___________________________|        defined by each operation
  99.     14 |windGlobals                | LONG - pointer to Window Globals (defined below)
  100.        |___________________________|
  101.     12 |OperationCode|               WORD - operation number to be performed
  102.        |_____________|_____________
  103.      8 |theWindow                  | LONG - pointer to window's record
  104.        |___________________________|
  105.      4 |param                      | LONG - pointer to additional parameter
  106.        |___________________________|        defined by each operation
  107.      1 | RTL address        |        BYTE[3] - long return address
  108.        |____________________|______
  109.        |                           | <-- Stack Pointer
  110.        |                           |
  111.  
  112.               Figure 1 - Stack Prior to Calling a Window defProc
  113.  
  114. The defProc must return with the carry flag clear if there was no error or 
  115. with the carry flag set and the y register set with an error code if there was 
  116. an error.
  117.  
  118. Window globals (windGlobals) is a pointer to a table of variables which the 
  119. Window Manager maintains for use by the defProc.  The table is defined as 
  120. follows:
  121.  
  122.     lineW           WORD      Width of vertical lines (size depends on video mode).
  123.     titleHeight     WORD      Height of a standard title bar.
  124.     titleYPos       WORD      Y offset for the title (in system font) to center in
  125.                               a standard title bar.
  126.     closeHeight     WORD      Height of the close box icon.
  127.     closeWidth      WORD      Width of the close box icon.
  128.     defWindClr      LONG      Pointer to the default window color table.
  129.     windIconFont    LONG      Handle of the current window icon font.
  130.     screenMode      WORD      TRUE if 640 mode, FALSE if 320 mode.
  131.     pattern         BYTE[32]  Temporary pattern buffer.
  132.     callerDpage     WORD      Direct page pointer of the last caller to TaskMaster.
  133.     callerDataB     WORD      Data bank of the last caller to TaskMaster
  134.                               (bank in both bytes).
  135.  
  136. Operation numbers are as follows (each operation is described later in its own 
  137. section):
  138.  
  139.     wDraw           0         Draw the window's frame.
  140.     wHit            1         Tell in what region the mouse button was pressed.
  141.     wCalcRgns       2         Calculate wStrucRgn and wContRgn.
  142.     wNew            3         Complete the creation of a window.
  143.     wDispose        4         Complete the disposal of a window.
  144.     wGetDrag        5         Return address that will draw the outline of the window
  145.                               while dragging.
  146.     wGrowFrame      6         Draw the outline of a window being resized.
  147.     wRecSize        7         Return size of the additional space needed in the window record.
  148.     wPosition       8         Return RECT that is the window's portRect.
  149.     wBehind         9         Return where the window should be placed in the window list.
  150.     wCallDefProc    10        Generic call to a defProc, defined by the defProc.
  151.  
  152.  
  153. wDraw, Operation 0
  154.  
  155. The wDraw operation draws the window's frame and is only called for visible 
  156. windows.  This operation draws in local coordinates in the current GrafPort, 
  157. which is the Window Manager's GrafPort.  When the drawing is finished, the 
  158. only states of the GrafPort that may have changed are the pen pattern, the 
  159. fill pattern, and the pen size, as all other states must be the same as when 
  160. the defProc was called.  This means that if you change the font to print some 
  161. text, you must save and restore the original font.  For the pen, PenNormal 
  162. will restore the pen to an acceptable state.
  163.  
  164. Param is defined as follows:
  165.  
  166.     Bit 31        1 to highlight the indicated part, 0 to unhighlight.
  167.     Bits 0-30     The part to draw (either highlighted or unhighlighted):
  168.                   0    Draw the window's entire frame, including any frame 
  169.                        controls and the items listed below.  Note that you 
  170.                        should check the window's fHilited flag to determine 
  171.                        how to draw the frame.
  172.                   1    Draw the go-away region.
  173.                   2    Draw the zoom region.
  174.                   3    Draw the information bar.
  175.  
  176. Result returned must be zero and the carry flag must be clear.
  177.  
  178. The Window Manager will draw the content.
  179.  
  180. Need to Redraw Your Window?
  181.  
  182. If your custom window defProc gets called to change some item in its window 
  183. record (see wCallDefProc below), you may want to redraw your window.  For 
  184. instance, if your application makes a SetWTitle call, you would want to draw 
  185. the name of the new title on the screen.
  186.  
  187. The routine wCallDefProc can call the wDraw routine to do this drawing.  
  188. However, it should bracket the calls to wDraw with two Window Manager calls 
  189. that save and restore some internal variables:
  190.  
  191.     StartFrameDrawing    $5A0E
  192.     PUSH:LONG            Pointer to the window record (not the GrafPort)
  193.  
  194. This call does the setup for drawing a window frame and is only called by a 
  195. window definition procedure before drawing the frame.  You should call 
  196. EndFrameDrawing when finished drawing.
  197.  
  198.  
  199.     EndFrameDrawing      $5B0E
  200.     No input or output
  201.  
  202. This call restores the Window Manager variables after a call to 
  203. StartFrameDrawing and is only called by a window definition procedure after 
  204. drawing a window frame.
  205.  
  206.  
  207. wHit, Operation 1
  208.  
  209. The wHit operation is called to hit test the window's frame.  Given a set of 
  210. screen coordinates, this operation should return what part, if any, of the 
  211. window is at that coordinate.  This operation is only called for visible 
  212. windows.  The current port will be that of the Window Manager and the window 
  213. frame will be in local coordinates.
  214.  
  215. Param is defined as:
  216.  
  217.     Bits 0-15     Vertical (Y) coordinate in local coordinates.
  218.     Bits 16-31    Horizontal (X) coordinate in local coordinates.
  219.  
  220. Result returned must be one of the following values and the carry flag must be 
  221. clear:
  222.  
  223.     wNoHit         0    Not on the window at all.
  224.     wInDrag       20    Coordinates are in the window's drag region (title bar).
  225.     wInGrow       21    Coordinates are in the window's grow region (size box).
  226.     wInGoAway     22    Coordinates are in the window's go-away region (close box).
  227.     wInZoom       23    Coordinates are in the window's zoom region (zoom box).
  228.     wInInfo       24    Coordinates are in the window's information bar.
  229.     wInFrame      27    Coordinates are in the window, but not in any of the
  230.                         other areas.
  231.                   xx    Any code the application can handle (bit 15 is 
  232.                         reserved for theWindow Manager)
  233.  
  234.  
  235. wCalcRgns, Operation 2
  236.  
  237. The wCalcRgns operation, which is called only for visible windows, is used to 
  238. calculate the window's entire region (frame plus content called StrucRgn) and 
  239. just its content region (called ContRgn).  Both regions must be set to global 
  240. coordinates, and both will already be allocated with their handles stored in 
  241. the window record's wStrucRgn and wContRgn fields.
  242.  
  243. Use the portRect and the boundsRect of the window's GrafPort to calculate 
  244. these two regions.  The port will have been set from the information passed to 
  245. NewWindow along with any size changes.  A method for obtaining the global RECT 
  246. of the content is given below.  Refer to the QuickDraw II chapter in the Apple 
  247. IIGS Toolbox Reference for a full description of ports.  When calculating the 
  248. regions, do not change the clip region (ClipRgn) or the visible region 
  249. (VisRgn) of the GrafPort.
  250.  
  251. Param is not defined and should not be used.
  252.  
  253. Result returned must be zero and the carry flag must be clear.
  254.  
  255.     IN:    window = pointer to window record.
  256.     OUT:    rect = global RECT of window's content.
  257.     
  258.         ldy    #wPort+portRect+y1
  259.         lda    [<window],y
  260.         ldy    #wPort+portInfo+boundsRect+y1
  261.         sec
  262.         sbc    [<window],y
  263.         sta    <rect+y1
  264.     ;
  265.         ldy    #wPort+portRect+x1
  266.         lda    [<window],y
  267.         ldy    #wPort+portInfo+boundsRect+x1
  268.         sec
  269.         sbc    [<window],y
  270.         sta    <rect+x1
  271.     ;
  272.         ldy    #wPort+portRect+y2
  273.         lda    [<window],y
  274.         ldy    #wPort+portInfo+boundsRect+y1
  275.         sec
  276.         sbc    [<window],y
  277.         sta    <rect+y2
  278.     ;
  279.         ldy    #wPort+portRect+x2
  280.         lda    [<window],y
  281.         ldy    #wPort+portInfo+boundsRect+x1
  282.         sec
  283.         sbc    [<window],y
  284.         sta    <rect+x2
  285.  
  286. Although there are other ways to obtain the global RECT of the content, this 
  287. example gives the correct method.  You should never rely on the top and left 
  288. side of the portRect being zero.
  289.  
  290.  
  291. wNew, Operation 3
  292.  
  293. The wNew operation is called to perform any additional initialization that may 
  294. be required for a custom window.  The following items are already done for the 
  295. window:
  296.  
  297. o    If a window record is supposed to be allocated, it is.  All fields, other 
  298.      than those fields listed below, are set to zero
  299. o    A port  opens in the window record's wPort field.
  300. o    The window is added to the Window Manager's window list, and the wNext 
  301.      field is set.
  302. o    The wDefProc, wStrucRgn, wContRgn and wUpdate regions are set with the 
  303.      handles of the allocated regions.  It is the responsibility of the defProc 
  304.      to define the shape of the wStrucRgn and wContRgn regions.
  305. o    The fAllocated and fHilited bits in the wFrame field of the window record 
  306.      are set (see the window record definition for a definition of these bits) 
  307.      and should not be disturbed; all other bits in wFrame are set to zero.  The 
  308.      defProc should set the fCtlTie, fVis and fQContent bits, and it can set and 
  309.      use other bits in the wFrame field as it wishes.
  310. o    It is the responsibility of the defProc to set the wRefCon, wContDraw, and 
  311.      wFrameCtls fields, the bits already mentioned in the wFrame field, and any 
  312.      other fields which it defines in the wCustom part of the window record.
  313.  
  314. Param is a pointer to the parameter list pointer which was passed to 
  315. NewWindow.
  316.  
  317. Result returned must be zero and the carry flag must be clear.
  318.  
  319.  
  320. wDispose, Operation 4
  321.  
  322. The wDispose operation is called to perform any additional disposal that may 
  323. be required of a custom window.  This operation is called before the Window 
  324. Manager performs any disposal actions on the window.
  325.  
  326. Param is not defined and should not be used.
  327.  
  328. Result should be FALSE to continue disposal or TRUE to abort the disposal.  In 
  329. either case, the carry flag should be clear.  Returning TRUE would be very 
  330. unusual and should be carefully thought out.  After returning FALSE, the 
  331. Window Manager will erase the window, remove the window from the Window 
  332. Manager's window list, free any controls in the window's wControls and 
  333. wFrameCtl lists, free the handles in the wStrucRgn, wContRgn and wUpdateRgn 
  334. fields, close the window's GrafPort, and free its record if it is allocated 
  335. (see the wFrame field).
  336.  
  337.  
  338. wGetDrag, Operation 5
  339.  
  340. The wGetDrag operation is called to get the address of a routine that will 
  341. draw an outline of the window.
  342.  
  343. Param is not defined and should not be used.
  344.  
  345. Result returned must be the address of a frame outline routine or zero for a 
  346. default frame; the default frame is the bounds RECT of the strucRgn.  The 
  347. frame outline routine is called from DragRect with dragRectPtr set to the 
  348. bounds RECT of the strucRgn.  Your routine is called with the following 
  349. parameters:
  350.  
  351.     PUSH:WORD - delta X
  352.     PUSH:WORD - delta Y
  353.     PUSH:BYTE[3] - return address
  354.  
  355. Your routine should draw or erase the outline of the object in its new 
  356. position using the passed deltas.  You have several different methods of 
  357. determining whether to erase or draw and how to compute the position of the 
  358. object, the easiest method being to draw the outline using XOR mode.  The 
  359. first time your routine is called, you draw.  The next time your routine is 
  360. called, you erase.  Your routine should draw in the current port.  The current 
  361. pen pattern will be the pattern pointed to by dragPatternPtr from DragRect and 
  362. the pen mode is XOR.
  363.  
  364. You also need to know where to draw the outline.  One way is to offset the 
  365. starting RECT (dragRectPtr) by the given deltas.  You should make a copy of 
  366. the bounds RECT of the strucRgn when wGetDrag is called.  Modify that 
  367. rectangle with the deltas to obtain the rectangle to frame.
  368.  
  369.  
  370. wGrowFrame, Operation 6
  371.  
  372. The wGrowFrame operation is called to draw an outline of the window when the 
  373. window is being resized.
  374.  
  375. This operation should use the current port, pen pattern, and pen mode.  The 
  376. frame should be drawn with only the following QuickDraw II calls:  Line, 
  377. LineTo, FrameRect, FrameRgn, FramePoly, FrameOval, FrameRRect, and FrameArc 
  378. (the Invert equivalents to Frame could also be used).  You want to use the 
  379. current GrafPort setting with only certain QuickDraw II calls since this 
  380. routine will be called an even number of times; the first time it is called to 
  381. draw the frame and the next time to erase that which it drew the first time.  
  382. If it needs to use QuickDraw II calls other than those listed above, this 
  383. operation handler could keep track of odd and even calls to know whether to 
  384. draw or erase the frame.
  385.  
  386. Param is a pointer to the following parameter list:
  387.  
  388.     newSize      RECT    Rectangle that defines the new size.
  389.     drawFlag     WORD    TRUE to draw the frame, FALSE to erase.
  390.     startRect    RECT    Bounds of wStrucRgn when dragging started.
  391.     deltaY       WORD    Vertical movement since starting to drag (signed).
  392.     deltaX       WORD    Horizontal movement since starting to drag (signed).
  393.  
  394. Result should be:
  395.  
  396.         ____________...____________________________
  397.        | 31| 30| 29|...| 6 | 5 | 4 | 3 | 2 | 1 | 0 |
  398.         ____________...____________________________
  399.                                              |   |
  400.                  TRUE if newSize RECT has been   +-- TRUE if frame drawn,
  401.                  recomputed, FALSE if newSize        FALSE to draw default frame.
  402.                  RECT OK.
  403.  
  404. The Window Manager assumes that the frame of the grow outline is the same as 
  405. the bounds of the window's wStrucRgn.  This RECT is stored in the startRect of 
  406. the parameter list and does not change through out the dragging.  The next 
  407. assumption is that the window grows from the lower right corner.  As the 
  408. cursor moves, the lower right corner of the RECT in newSize changes.  However, 
  409. if these assumptions are not correct for a custom window they can be 
  410. overridden by changing the RECT in newSize (by using startRect or the window's 
  411. record and the deltas) and returning TRUE for bit 1 in Result.  The carry flag 
  412. should return clear.
  413.  
  414.  
  415. wRecSize, Operation 7
  416.  
  417. The wRecSize operation is called to ask how large a window record should be 
  418. allocated.
  419.  
  420. Note:  The window pointer passed in theWindow is not valid for this call.
  421.  
  422. Param is the parameter list pointer that is passed to NewWindow.
  423.  
  424. Result is the number of additional bytes required in the window record.  The 
  425. standard window record header will always be allocated.
  426.  
  427. Example:
  428.  
  429. If your custom window needs a one word field in the window record for your own 
  430. use you would return 2 in Result.  The Window Manager takes Result and adds to 
  431. it the size of the standard record header of 212 bytes and allocates a window 
  432. record that is 214 bytes long in this case.  Your one word field is at the end 
  433. of the standard window record header with an offset of 212 bytes.
  434.  
  435. If there is some error, return the carry flag set with an error code in the y 
  436. register, which will cause NewWindow to abort and return the error code to the 
  437. application which called it.  If there is no error, return the carry flag 
  438. clear.
  439.  
  440. Window Record Already Allocated?
  441.  
  442. If the window record is already allocated then Result should be the pointer to 
  443. the window record with bit 31 of the pointer set to TRUE.  Generally, window 
  444. records are allocated (refer to Window Record Definition at the end of this 
  445. Note for more information about window records).
  446.  
  447.  
  448. wPosition, Operation 8
  449.  
  450. Param is the parameter list pointer that is passed to NewWindow.
  451.  
  452. Result is a pointer to the RECT that will be the window's portRect, and you 
  453. should return the carry flag clear.
  454.  
  455.  
  456. wBehind, Operation 9
  457.  
  458. Param is the parameter list pointer that is passed to NewWindow.
  459.  
  460. Result is where the window should be placed in the window list.  A long 
  461. $FFFFFFFF means insert the window as the top window while a long $00000000 
  462. means to insert it as the bottom window.  Any other value is a pointer to the 
  463. window behind which this window should be placed.  You should return the carry 
  464. flag clear.
  465.  
  466.  
  467. wCallDefProc, Operation 10
  468.  
  469. WCallDefProc is a generic call to the defProc that is defined by the defProc.  
  470. With this call a window defProc can define many special functions.
  471.  
  472. The input to the defProc is:
  473.  
  474.     param = pointer to the following parameter table:
  475.  
  476.     dRequest    WORD       Requested operation number.
  477.     paramID     WORD       Parameter block type:
  478.                            $0000-$7FFF reserved by system ($0000 defined below).
  479.                            $8000-$FFFF reserved for custom defProcs.
  480.     newParam    BYTE[n]    New parameter field used by some operations.
  481.  
  482. The paramID field defines dRequest, which in turn defines newParam and the 
  483. result of the wCallDefProc call.  You can think of dRequest as the operation 
  484. number passed to the defProc.  Here is an example of how the paramID defines 
  485. dRequest:  if paramID is zero, dRequest 3 is defined as wSetPage (defined 
  486. below); but if paramID is $8345 (or any number other than zero), dRequest 3 
  487. could be defined as something entirely different.
  488.  
  489. The following dRequest values are defined for wCallDefProc operations with a 
  490. paramID of zero.  Your defProc should check for handling only these codes.  In 
  491. the future, codes 34 and greater may be defined, and your defProc should know 
  492. not to handle them.
  493.  
  494.     wSetOrgMask         0    wGetInfoDraw       17
  495.     wSetMaxGrow         1    wGetOrigin         18
  496.     wSetScroll          2    wGetDataSize       19
  497.     wSetPage            3    wGetZoomRect       20
  498.     wSetInfoRefCon      4    wGetTitle          21
  499.     wSetInfoDraw        5    wGetColorTable     22
  500.     wSetOrigin          6    wGetFrameFlag      23
  501.     wSetDataSize        7    wGetInfoRect       24
  502.     wSetZoomRect        8    wGetDrawInfo       25
  503.     wSetTitle           9    wGetStartInfoDraw  26
  504.     wSetColorTable     10    wGetEndInfoDraw    27
  505.     wSetFrameFlag      11    wZoomWindow        28
  506.     wGetOrgMask        12    wStartDrawing      29
  507.     wGetMaxGrow        13    wStartMove         30
  508.     wGetScroll         14    wStartGrow         31
  509.     wGetPage           15    wNewSize           32
  510.     wGetInfoRefCon     16    wTask              33
  511.  
  512. wSetOrgMask                0
  513.     newParam    =    WORD - window's origin mask.
  514.     result      =    None.
  515.  
  516.     Called when SetOriginMask is called.
  517.  
  518. wSetMaxGrow                1
  519.     newParam    =    WORD - maximum window height.
  520.                      WORD - maximum window width.
  521.     result      =    None.
  522.  
  523.     Called when SetMaxGrow is called.
  524.  
  525. wSetScroll                 2
  526.     newParam    =    WORD - number of pixels to scroll when arrow is
  527.                             selected.
  528.     result      =    None.
  529.  
  530.     Called when SetScroll is called.
  531.  
  532. wSetPage                   3
  533.     newParam    =    WORD - pixels to scroll when page region is selected.
  534.     result      =    None.
  535.  
  536.     Called when SetPage is called.
  537.  
  538. wSetInfoRefCon             4
  539.     newParam    =    LONG - value passed to info bar draw routine
  540.                             (app's use only).
  541.     result      =    None.
  542.  
  543.     Called when SetInfoRefCon is called.
  544.  
  545. wSetInfoDraw               5
  546.     newParam    =    LONG - address of info bar draw routine.
  547.     result      =    None.
  548.  
  549.     Called when SetInfoDraw is called.
  550.  
  551. wSetOrigin                 6
  552.     newParam    =    WORD - flag, TRUE to scroll content.
  553.                      WORD - window's Y origin.
  554.                      WORD - window's X origin.
  555.     result      =    None.
  556.  
  557.     Called when SetContentOrigin is called.
  558.  
  559. wSetDataSize               7
  560.     newParam    =    WORD - height of window's data area.
  561.                      WORD - width of window's data area.
  562.     result      =    None.
  563.  
  564.     Called when SetDataSize is called.
  565.  
  566. wSetZoomRect               8
  567.     newParam    =    LONG - pointer to new zoom RECT.
  568.     result      =    None.
  569.  
  570.     Called when SetZoomRect is called.
  571.  
  572. wSetTitle                  9
  573.     newParam    =    LONG - pointer to new title.
  574.     result      =    None.
  575.  
  576.     Called when SetWTitle is called.
  577.  
  578. wSetColorTable            10
  579.     newParam    =    LONG - pointer to new color table.
  580.     result      =    None.
  581.  
  582.     Called when SetFrameColor is called.
  583.  
  584. wSetFrameFlag             11
  585.     newParam    =    LONG - pointer to new zoom RECT.
  586.     result      =    None.
  587.  
  588.     Called when SetWFrame is called.
  589.  
  590. wGetOrgMask               12
  591.     newParam    =    None.
  592.     result      =    WORD - window's origin mask.
  593.  
  594. wGetMaxGrow               13
  595.     newParam    =    None.
  596.     result      =    Low word is window's maximum height when grown.
  597.                      High word is window's maximum width when grown.
  598.  
  599.     Called when GetMaxGrow is called.
  600.  
  601. wGetScroll                14
  602.     newParam    =    None.
  603.     result      =    Low word is number of pixels to scroll when arrow is 
  604.                      selected.
  605.  
  606.     Called when GetScroll is called.
  607.  
  608. wGetPage                  15
  609.     newParam    =    None.
  610.     result      =    Low word is pixels to scroll when page region is selected.
  611.  
  612.     Called when GetPage is called.
  613.  
  614. wGetInfoRefCon            16
  615.     newParam    =    None.
  616.     result      =    Value passed to info bar draw routine.
  617.  
  618.     Called when GetInfoRefCon is called.
  619.  
  620. wGetInfoDraw              17
  621.     newParam    =    None.
  622.     result      =    Address of info bar draw routine.
  623.  
  624.     Called when GetInfoDraw is called.
  625.  
  626. wGetOrigin                18
  627.     newParam    =    None.
  628.     result      =    Low word is content's Y origin.
  629.                      High word is content's X origin.
  630.  
  631.     Called when GetContentOrigin is called.
  632.  
  633. wGetDataSize              19
  634.     newParam    =    None.
  635.     result      =    Low word is window's data height.
  636.                      High word is window's data width.
  637.  
  638.     Called when GetDataSize is called.
  639.  
  640. wGetZoomRect              20
  641.     newParam    =    None
  642.     result      =    Pointer to window's current zoom RECT.
  643.  
  644.     Called when GetZoomRect is called.
  645.  
  646. wGetTitle                 21
  647.     newParam    =    None
  648.     result      =    Pointer to window's title.
  649.  
  650.     Called when SetWTitle is called.
  651.  
  652. wGetColorTable            22
  653.     newParam    =    None.
  654.     result      =    Pointer to window's color table.
  655.  
  656.     Called when SetFrameColor is called.
  657.  
  658. wGetFrameFlag             23
  659.     newParam    =    None.
  660.     result      =    Low word is window's wFrame field.
  661.  
  662.     Called when SetWFrame is called.
  663.  
  664. wGetInfoRect              24
  665.     newParam    =    LONG - pointer to place to store info bar's enclosing RECT.
  666.     result      =    None.
  667.  
  668.     Called when GetRectInfo is called.
  669.  
  670. wGetDrawInfo              25
  671.     newParam    =    None.
  672.     result      =    None.
  673.  
  674.     Called when DrawInfoBar is called.
  675.  
  676. wGetStartInfoDraw         26
  677.     newParam    =    LONG - pointer to place to store info bar's enclosing 
  678.                      RECT.
  679.     result      =    None.
  680.  
  681.     Called when StartInfoDrawing is called.
  682.  
  683. wGetEndInfoDraw           27
  684.     newParam    =    None.
  685.     result      =    None.
  686.  
  687.     Called when EndInfoDrawing is called.
  688.  
  689. wZoomWindow               28
  690.     newParam    =    None.
  691.     result      =    None.
  692.  
  693.     Called when ZoomWindow is called.
  694.  
  695. wStartDrawing             29
  696.     newParam    =    None.
  697.     result      =    None.
  698.  
  699.     Called when StartDrawing is called.
  700.  
  701. wStartMove                30
  702.     newParam    =    WORD - new y position (global).
  703.                      WORD - x position (global).
  704.     result      =    Low word is new y position (global).
  705.                      High word is x position (global).
  706.  
  707.     Called before MoveWindow moves a window.
  708.  
  709. wStartGrow                31
  710.     newParam    =    None.
  711.     result      =    None.
  712.  
  713.     Called before GrowWindow tracks the growing of a window.
  714.  
  715. wNewSize                  32
  716.     newParam    =    LONG - pointer to:
  717.                      WORD - proposed new height.
  718.                      WORD - proposed new width.
  719.                      These two values can be changed.
  720.     result      =    Low word TRUE if only uncovered content should be drawn.
  721.                      FALSE if entire content should be redrawn.
  722.  
  723.     Called by SizeWindow before it resizes a window.  The new height and 
  724.     width can be changed by modifying the words pointed to by the pointer in 
  725.     newParam.
  726.  
  727. wTask                     33
  728.     newParam    =    LONG - pointer to task record.
  729.                      WORD - result from FindWindow.
  730.     result      =    Low word is code returned by TaskMaster (zero if handled).
  731.                      High word is task performed.  Returned in TaskData if code 
  732.                      is 0.
  733.  
  734.     Called from TaskMaster when it cannot handle a task.  If the user 
  735.     presses the mouse button over a window, TaskMaster will call FindWindow 
  736.     to find out what part of the window.  TaskMaster will then handle the 
  737.     task if FindWindow returns wInMenuBar or bit 15 of the window pointer is 
  738.     set (system window).  Otherwise, the result of FindWindow is passed to 
  739.     wTask to be handled or not.
  740.  
  741.     If the defProc can handle the task it should do so and return zero in 
  742.     the low word of the result (which will be the result to the application 
  743.     returned from TaskMaster) and a code of the task performed in the high 
  744.     word of the result (which is returned to the application in its task 
  745.     record TaskData field).  Fields in the task record may also be modified 
  746.     to return parameters to the application as this is the same record 
  747.     passed to TaskMaster.
  748.  
  749.     If the defProc cannot handle the task, it should return the result from 
  750.     FindWindow (the second field in newParam) in the low word of the result.  
  751.     The high word of the result is not used.
  752.  
  753.     For example, the standard document window defProc handles the following 
  754.     results from FindWindow if the taskMask record allows.
  755.  
  756.     wInContent    Brings the window to the top.
  757.     wInDrag       Calls DragWindow.
  758.     wInGrow       Brings the window to the top.  If it is already on the 
  759.                   top, it calls GrowWindow and SizeWindow.
  760.     wInGoAway     Calls TrackGoAway.
  761.     wInZoom       Calls TrackZoom and ZoomWindow.
  762.     wInInfo       Brings the window to the top.
  763.     wInFrame      Brings the window to the top.  If it is already on the 
  764.                   top, checks if it is on one of the window's scroll 
  765.                   bars, tracks it, and scrolls the window's content as 
  766.                   needed.
  767.  
  768.     A custom window defProc can return any code (bit 15 is used for system 
  769.     windows) it wants when it is called to do a hit test.  This code would 
  770.     be that returned by FindWindow, and the application would have to know 
  771.     about the code if it called FindWindow instead of TaskMaster.  If 
  772.     TaskMaster is used, the code that FindWindow returns is passed back to 
  773.     your defProc with a wCallDefProc and wTask.  The defProc could perform 
  774.     any task it wanted:  change colors, eject a disk, run a spelling 
  775.     checker, or anything else.
  776.  
  777.  
  778. Window Record Definition
  779.  
  780.  
  781.      0 |wNext                 | LONG - Pointer to next window record,
  782.        |______________________|_        zero is end of list.
  783.      4 |wPort ///               | BYTE[170] - Window's GrafPort.
  784.        |________________________|
  785.    174 |wDefProc              | LONG - Address of window's definition
  786.        |______________________|        procedure.
  787.    178 |wRefCon               | LONG - Reserved for application's use.
  788.        |______________________|
  789.    182 |wContDraw             | LONG - Address of routine that will draw
  790.        |______________________|        window's content.
  791.    186 |wReserved             | LONG - Reserved by the Window Manager,
  792.        |______________________|        do not use.
  793.    190 |wStrucRgn             | LONG - Handle of window's structure region.
  794.        |______________________|
  795.    194 |wContRgn              | LONG - Handle of window's content region.
  796.        |______________________|
  797.    198 |wUpdateRgn            | LONG - Handle of window's update region.
  798.        |______________________|
  799.    202 |wCtls                 | LONG - Handle of first control in
  800.        |______________________|        window's content.
  801.    206 |wFrameCtls            | LONG - Handle of first control in
  802.        |______________________|        window's frame.
  803.    210 |wFrame     |            WORD - Flags that define window.
  804.        |___________|
  805.    212 |wCustom    ...          BYTE[n] - Additional data space defined by
  806.        |___________...                    window's definition procedure.
  807.  
  808. The changes use some vacant space under the window port and add the wReserved 
  809. field to the record for future expansion.
  810.  
  811. In addition to defining the window record, the wFrame field needs to be 
  812. further defined.  In the diagram below the shaded bits are reserved for use by 
  813. each window defProc (the values shown are those used by the standard document 
  814. window defProc).  Bits not shaded are reserved by the Window Manager and are 
  815. applicable to all windows.
  816.  
  817.  
  818. Further Reference
  819. o    Apple IIGS Toolbox Reference, Volume 1
  820. o    System Disk 4.0 Release Notes
  821.  
  822.